package router

import (
	"server/application/constant/apis"
	"server/application/controller/sysctrl"
	"server/application/db/system/dbdto"
	"server/application/dto"
	"server/pkg/ginp"
)

func init() {

	//创建
	AppendRouter(ItemInfo{ //create
		Path:           apis.ApiSysRolePermissionsCreate,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysRolePermissionsCreate), //对应控制器
		HttpType:       HttpPost,                                           //http请求类型
		NeedLogin:      true,                                               //是否需要登录
		NeedPermission: true,                                               //是否需要鉴权
		PermissionName: "SysRolePermissions.create",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "新增权限",
			RequestDto: dbdto.SysRolePermissionsCreate{},
		},
	})

	//修改
	AppendRouter(ItemInfo{ //update
		Path:           apis.ApiSysRolePermissionsUpdate,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysRolePermissionsUpdate), //对应控制器
		HttpType:       HttpPost,                                           //http请求类型
		NeedLogin:      true,                                               //是否需要登录
		NeedPermission: true,                                               //是否需要鉴权
		PermissionName: "SysRolePermissions.update",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "修改权限",
			RequestDto: dbdto.SysRolePermissionsUpdate{},
		},
	})

	// 删除
	AppendRouter(ItemInfo{ //delete
		Path:           apis.ApiSysRolePermissionsDelete,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysRolePermissionsDelete), //对应控制器
		HttpType:       HttpPost,                                           //http请求类型
		NeedLogin:      true,                                               //是否需要登录
		NeedPermission: true,                                               //是否需要鉴权
		PermissionName: "SysRolePermissions.delete",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "删除权限",
			RequestDto: dbdto.SysRolePermissionsDelete{},
		},
	})

	//search 搜索
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiSysRolePermissionsSearch,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysRolePermissionsSearch), //对应控制器
		HttpType:       HttpPost,                                           //http请求类型
		NeedLogin:      true,                                               //是否需要登录
		NeedPermission: false,                                              //是否需要鉴权
		PermissionName: "SysRolePermissions.search",                        //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "权限列表",
			RequestDto: dto.ReqSearch{},
		},
	})

	//获取按钮权限
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiAuthGetUserButtonList,               //api路径
		Handlers:       ginp.ConvHandler(sysctrl.GetButtonAuthList), //对应控制器
		HttpType:       HttpPost,                                    //http请求类型
		NeedLogin:      true,                                        //是否需要登录
		NeedPermission: false,                                       //是否需要鉴权
		PermissionName: "SysRolePermissions.search",                 //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title: "获取按钮权限",
		},
	})

	//保存角色的权限
	AppendRouter(ItemInfo{ //search
		Path:           apis.ApiSysRolePermissionsSave,                   //api路径
		Handlers:       ginp.ConvHandler(sysctrl.SysRolePermissionsSave), //对应控制器
		HttpType:       HttpPost,                                         //http请求类型
		NeedLogin:      true,                                             //是否需要登录
		NeedPermission: false,                                            //是否需要鉴权
		PermissionName: "SysRolePermissions.search",                      //完整的权限名称,会跟权限表匹配
		Swagger: &SwaggerInfo{
			Title:      "保存角色的权限",
			RequestDto: dto.RequestSysRolePermissionsSave{},
		},
	})

	//{{append}}
}
